<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>




<c:if test="${!empty userActives}">
	<h1>User Actives</h1>

	<div class="container dontprint">
		<form:form method="post" action="history/search">

			<!-- 		<script type="text/javascript" -->
			<%-- 			src='<c:url value="/resources/js/jquery-1.11.0.js"></c:url>'></script> --%>
			<!-- 		<script type="text/javascript" -->
			<%-- 			src='<c:url value="/resources/js/bootstrap-datepicker.js"></c:url>'></script> --%>

			<script>
				if (top.location != location) {
					top.location.href = document.location.href;
				}
				$(function() {

					var checkin = $('#dpd1').datepicker({
						format : 'yyyy-mm-dd'
					}).on('changeDate', function(ev) {
						if (ev.date.valueOf()) {
							var newDate = new Date(ev.date);
							newDate.setDate(newDate.getDate() + 1);
							checkout.setValue(newDate);
						}
						checkin.hide();
						$('#dpd2')[0].focus();
					}).data('datepicker');
					var checkout = $('#dpd2').datepicker(
							{
								format : 'yyyy-mm-dd',
								onRender : function(date) {
									return date.valueOf() <= checkin.date
											.valueOf() ? 'disabled' : '';
								}
							}).on('changeDate', function(ev) {
						checkout.hide();
					}).data('datepicker');
				});
			</script>

			<input type="text" class="input-medium"
				value="<c:if test="${not empty admin}">${admin}</c:if>" name="user"
				placeholder='user' />
			<input onkeydown="return false;" type="text" id="dpd1"
				class="input-medium"
				value="<c:if test="${not empty beginPeriod}">${beginPeriod}</c:if>"
				name="beginPeriod" placeholder='Check in' />
			<input onkeydown="return false;" type="text" id="dpd2"
				class="input-medium"
				value="<c:if test="${not empty endPeriod}">${endPeriod}</c:if>"
				name="endPeriod" placeholder='Check out' />
			<input type="submit" class="btn btn-primary" value="Search" />
		</form:form>
	</div>

	<table class="table table-hover">
		<tr>
			<th>User</th>
			<th>Name service</th>
			<th>Description service</th>
			<th>Action</th>
		</tr>
		<c:forEach items="${userActives}" var="userActive">
			<tr>
				<td>${userActive.user.firstname}${subscribe.user.lastname}</td>
				<td>${userActive.service.nameService}</td>
				<td>${userActive.service.description}</td>
				<td><a class="btn btn-danger"
					href='<c:url value="/history/delete/${userActive.id}"></c:url>'>
						Delete</a></td>

			</tr>
		</c:forEach>
	</table>
</c:if>
<br />

